<?php

namespace app\admin\model;

use app\admin\model\BaseModel;


class Check extends BaseModel
{

    protected $name = "check";
    protected $pk = "id";
    // 追加属性
    protected $append = [
        'status_title', 'admin_title',
    ];
    protected $deleteTime = false;




    public function getStatusList()
    {
        return [
            1 => '已通过',
            2 => '未通过'
        ];
    }


    public function getStatusTitleAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
        $list = $this->getStatusList();
        return isset($list[$value]) ? $list[$value] : '待审核';
    }


    public function getAdminTitleAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['admin_id']) ? $data['admin_id'] : '');
        $admin = table('system_admin')->where(['id' => $data['admin_id']])->find();
        return isset($admin['nickname']) ? $admin['nickname'] : '未分配';
    }
}
